package gwtappcontainer.client.apps.undefined;

import gwtappcontainer.client.IPresenter;

import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;

class UndefinedPresenter implements IPresenter {
	
	interface IView {
		HasText getErrorLabel();
		Widget asWidget();
	}
	
	private IView view;		
	
	UndefinedPresenter(IView view, String appName) {
		this.view = view;
		bind(appName);
	}
	
	private void bind(String appName) {
		view.getErrorLabel().setText("Undefined App [" + appName + "]");
	}

	@Override
	public	void render(HasWidgets container) {
		container.clear();
		container.add(view.asWidget());		
	}

	@Override
	public String getAppName() {
		return "Undefined App";
	}
}
